package com.songlanyun.modules.shop.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.songlanyun.modules.shop.entity.ShopAdminRelationEntity;
import com.songlanyun.modules.shop.entity.ShopEntity;
import com.songlanyun.modules.shop.model.vo.ShopInfoVO;
import com.songlanyun.modules.shop.model.vo.ShopWithdrawVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Map;

/**
 * 商家表
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-03 14:34:03
 */
@Mapper
public interface ShopDao extends BaseMapper<ShopEntity> {

    ShopEntity selectPlatformShop();

    ShopEntity getShopByUserId(@Param("userId") Long userId, @Param("unionBusiness") boolean unionBusiness);

    Long getShopIdByUserId(@Param("userId") Long userId, @Param("unionBusiness") boolean unionBusiness);

    ShopEntity getSubShopById(@Param("userId") Long userId, @Param("unionBusiness") boolean unionBusiness);

    /**
     * 根据管理员id获取会员id
     *
     * @param userId
     * @return
     */
    Long getUserIdByAdminId(@Param("userId") Long userId, @Param("unionBusiness") boolean unionBusiness);


    /**
     * 获取提现相关金额
     *
     * @param shopId
     * @return
     */
    ShopWithdrawVO getWithdrawAmount(Long shopId);

    Long getAdminPriByShopId(Long shopId);

    /**
     * 根据商家id获取系统主账号的用户，是否已分配管理员的账号
     *
     * @param shopId
     * @return
     */

    boolean verifyAdminPriByShopId(Long shopId);

    ShopInfoVO getShopInfo(Long shopId);

    ShopEntity getShopByAdminId(@Param("userId") Long userId, @Param("unionBusiness") boolean unionBusiness);

    String getCodeByShopId(Long shopId);

    IPage<ShopInfoVO> shopPage(IPage<ShopInfoVO> page, @Param("vo") Map<String, Object> params);

    ShopEntity loadByIdForLock(@Param("shopId") Long shopId);
}
